package sun.net.www.protocol.x;


import org.springframework.core.io.ClassPathResource;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;

/**
 * X {@link URLConnection} 实现
 *
 * @author wangyh2
 * @version v1.0
 * @since 2021-10-24 17:05
 */
public class XURLConnection extends URLConnection {

    private final ClassPathResource resource;


    // URL = x:///META-INF/default.properties
    protected XURLConnection(URL url) {
        super(url);
        this.resource = new ClassPathResource(url.getPath());
    }

    @Override
    public void connect() throws IOException {

    }

    @Override
    public InputStream getInputStream() throws IOException {
        return resource.getInputStream();
    }
}
